package org.blogwu.learn.algorithm.chapter2.demo1;

public class Array {
    private int[] data;
    private int size;

    // 构造函数,传入数组的容量capacity 构造Array
    private Array(int capacity) {
        data = new int[capacity];
        size = 0;
    }

    // 默认构造函数,默认素组的容易为10;
    private Array() {
        this(10);
    }

    private Array(int[] data) {
        this.data = data;
        this.size = data.length;
    }

    // 获取数组中的元素个数
    public int getSize() {
        return size;
    }

    public int getCapacity() {
        return data.length;
    }

    // 判断数组是否为空
    public boolean isEmpty() {
        return size == 0;
    }
}
